// pages/community/index.js
const {
  SelTabbar
} = require('../../utils/tab-bar-sel.js')
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    statusBarHeight: app.globalData.statusBarHeight,

  },

  onShow() {
    SelTabbar(this, 1)
  },
  onReady() {
    wx.request({
      url: 'https://qh-free.supengjun.com/qinghang/api/circle/get_top_circle',
      header: {
        token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIhQCMkJSomIiwiYXVkIjoiIiwiaWF0IjoxNzAxMjM3OTI4LCJuYmYiOjE3MDEyMzc5MzEsImV4cCI6MTcwMTg0MjcyOCwiZGF0YSI6eyJ1aWQiOjEwMTA2NX19.5yLdFOiD8KV6rVNRGre35m1FJsisQOqc6k8ILQYtcAk"
      },
      success: (res) => {
        console.log(res)
        this.setData({
          putarr: res.data.data
        })
      }
    })
    wx.request({
      url: 'https://qh-free.supengjun.com/qinghang/api/circle/get_circle_list?page=1',
      header: {
        token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIhQCMkJSomIiwiYXVkIjoiIiwiaWF0IjoxNzAxMjM3OTI4LCJuYmYiOjE3MDEyMzc5MzEsImV4cCI6MTcwMTg0MjcyOCwiZGF0YSI6eyJ1aWQiOjEwMTA2NX19.5yLdFOiD8KV6rVNRGre35m1FJsisQOqc6k8ILQYtcAk"
      },
      success: (res) => {
        console.log(res)
        this.setData({
          list: res.data.data.data
        })
      }
    })
  },
  onPageScroll(e) {
    var trans = (e.scrollTop > 350 ? 350 : e.scrollTop) / 350;
    this.setData({
      navbarTrans: trans
    })
  },
  ComeToCommunity_detail() {
    wx.navigateTo({
      url: '/community/detail/index',
    })
  },
})